package com.xjoyt.pay.share.interfaces;

import java.util.List;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.xjoyt.pay.dto.ExecuteResult;
import com.xjoyt.pay.dto.PageParam;
import com.xjoyt.pay.dto.PageResult;
import com.xjoyt.pay.share.params.AreaPageParam;
import com.xjoyt.pay.share.po.Area;

/**
 * 行政区划接口
 * 
 * @author Administrator
 *
 */
public interface AreaContract {

	/**
	 * 获取
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping("get/{id}")
	Area get(@PathVariable("id") String id);

	/**
	 * 获取分页数据
	 * 
	 * @param param
	 * @return
	 */
	@RequestMapping(value = "loadPage", method = RequestMethod.POST)
	PageResult<Area> loadPage(PageParam<AreaPageParam> param);

	/**
	 * 保存
	 * 
	 * @param param
	 * @return
	 */
	@RequestMapping(value = "save", method = RequestMethod.POST)
	ExecuteResult<Area> save(Area param);

	/**
	 * 移除
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping("remove/{id}")
	ExecuteResult<?> remove(@PathVariable("id") String id);

	/**
	 * 通过父ID获取地区 查询省级，parentId为“0”
	 * 
	 * @param parentId
	 * @return
	 */
	@RequestMapping("findAllByParentId/{parentId}")
	List<Area> findAllByParentId(@PathVariable(value = "parentId", required = false) String parentId);

	/**
	 * 抓取地区
	 * 
	 * @return
	 */
	@RequestMapping("fetch/{key}")
	ExecuteResult<?> fetch(@PathVariable("key") String key);

	/**
	 * 根据parentId抓取地区
	 * 
	 * @param key
	 * @param parentId
	 * @return
	 */
	@RequestMapping("fetchByParentId/{key}/{parentId}")
	ExecuteResult<?> fetchByParentId(@PathVariable("key") String key,
			@PathVariable(value = "parentId", required = false) String parentId);

	/**
	 * 抓取任务是否执行
	 * 
	 * @return
	 */
	@RequestMapping("isRunFetch")
	ExecuteResult<Boolean> isRunFetch();

	/**
	 * 停止抓取任务
	 * 
	 * @return
	 */
	@RequestMapping("stopFetch")
	ExecuteResult<?> stopFetch();
}
